package caiziyou.com.designpattern.principle.inversion.improve;

public class DependecyInverion {

	public static void main(String[] args) {
		Person person = new Person();
		person.receive(new Email());
		person.receive(new Weixin());
	}
}

interface IReceiver{
	public String getInfo();
}

class Email implements IReceiver{
	
	@Override
	public String getInfo() {
		return "电子邮件信息： Email Info";
	}
}

class Weixin implements IReceiver{
	@Override
	public String getInfo() {
		return "微信信息： Weixin Info";
	}
}

class Person {

	public void receive(IReceiver receiver) {
		System.out.println(receiver.getInfo());
	}
}
